﻿@{      
    string status = String.Empty;
    if(JDM.HasFlags(Model.Flags, "Canceled"))
    {
        status = "Canceled";
    }
    else if(JDM.HasFlags(Model.Flags, "Pending"))
    {
        status = "Pending";
    }
    else if(JDM.HasFlags(Model.Flags, "Issued"))
    {
        status = "Issued";
    }
    else if(JDM.HasFlags(Model.Flags, "Paid"))
    {
        status = "Paid";
    }
}

<div class="box unit-overview invoice">
    <header>
        <h4>@T(Res.Name("Invoice"), 
            JDM.Int32(Model.EntityID), 
            Svc.Date((DateTime)JDM.DateTime(Model.CreatedOn)), 
            T(Res.In("API").Of("Enum").Of("InvoiceFlags").Name(status)))</h4>
    </header>
    <section>
        <table class="key-value highlight-key">
            <tr>
                <td>@T(Res.In("Common").Of("Vocab").Name("Guid"))</td>
                <td>@JDM.String(Model.Guid)</td>
            </tr>
            <tr>
                <td>@T(Res.Name("Order"))</td>
                <td><a href="@Url.Action(Loc.Act("Show").Ctrl("Order").Set(new
                {
                    id = JDM.Int32(Model.Order.EntityID)
                }).Localized())">@JDM.String(Model.Order.Guid)</a></td>
            </tr>
            <tr>
                <td>@T(Res.Name("RefundAmount"))</td>
                <td>@Svc.Price((decimal)JDM.Decimal(Model.RefundAmount))</td>
            </tr>
            <tr>
                <td>@T(Res.Name("PaidAmount"))</td>
                <td>@Svc.Price((decimal)JDM.Decimal(Model.PaidAmount))</td>
            </tr>
            <tr>
                <td>@T(Res.Name("Total"))</td>
                <td>@Svc.Price((decimal)JDM.Decimal(Model.Total))</td>
            </tr>
        </table>
    </section>
</div>

